package com;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

/**
 * jdbc工具类
 * 
 * @author lenovo
 * @date 2020年8月6日 @time 下午5:08:52
 */
public class DBUtil {
	public static Connection getConnection() throws ClassNotFoundException, SQLException {
		Class.forName("com.mysql.jdbc.Driver");
		Connection connection = DriverManager.getConnection("jdbc:mysql://127.0.0.1:3306/day_03", "root", "root");
		return connection;
	}

	public static void close(AutoCloseable autoCloseable) {
		try {
			if (autoCloseable != null) {
				autoCloseable.close();
			}
		} catch (Exception e2) {
			e2.printStackTrace();
		}
	}
}
